import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { CarrentalInfoVO, CarrentalInfoForm, CarrentalInfoQuery } from '@/api/zichanguanli/carrentalInfo/types';

/**
 * 查询汽车租赁信息列表
 * @param query
 * @returns {*}
 */

export const listCarrentalInfo = (query?: CarrentalInfoQuery): AxiosPromise<CarrentalInfoVO[]> => {
  return request({
    url: '/zichanguanli/carrentalInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询汽车租赁信息详细
 * @param id
 */
export const getCarrentalInfo = (id: string | number): AxiosPromise<CarrentalInfoVO> => {
  return request({
    url: '/zichanguanli/carrentalInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增汽车租赁信息
 * @param data
 */
export const addCarrentalInfo = (data: CarrentalInfoForm) => {
  return request({
    url: '/zichanguanli/carrentalInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改汽车租赁信息
 * @param data
 */
export const updateCarrentalInfo = (data: CarrentalInfoForm) => {
  return request({
    url: '/zichanguanli/carrentalInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除汽车租赁信息
 * @param id
 */
export const delCarrentalInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/zichanguanli/carrentalInfo/' + id,
    method: 'delete'
  });
};
